package com.zr.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zr.dao.BaseDao;
import com.zr.model.Point;
import com.zr.service.FinduppService;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

@Service("findup")
public class FindUppServiceImpl implements FinduppService{
		
	@Resource
	private BaseDao baseDao;
	
	@Override
	public JSONArray findUpp() {
		JSONArray ja = new JSONArray();
		List<Point> l = baseDao.find("from Point");
		for (Point point : l) {
			JSONObject j = new JSONObject();
			j.put("id", point.getPid());
			j.put("text", point.getPname());
			ja.add(j);
		}
		return ja;
	}
	
}
